

const 构建 = async (entryPoint = "index.js", outputPath = "dist/index.js") => {
  const esbuild = require("esbuild");
  try {
    // 执行构建
    await esbuild.build({
      entryPoints: [entryPoint],
      outfile: outputPath,
      platform: "node",
      bundle: true,
      minify: true,
      external: ["esbuild", "proxy-agent" , "canvas", "sharp","lidong-utils-zh"], // 添加 "esbuild" 到 external
      metafile: true, // 生成元数据文件
      write: true, // 自动写入文件
    });

    console.log("构建完成！");
  } catch (error) {
    console.error("构建失败:", error);
    process.exit(1);
  }
};

module.exports = 构建;
